<?php $this->load->view('header') ?>

<!-- start content-outer -->
<div id="content-outer">
    <!-- start content -->
    <div id="content">


        <div id="page-heading"><h1>View / Edit Event</h1></div>


        <table border="0" width="100%" cellpadding="0" cellspacing="0" id="content-table">
            <tr>
                <th rowspan="3" class="sized"><img src="<?php echo base_url(); ?>images/shared/side_shadowleft.jpg" width="20" height="300" alt="" /></th>
                <th class="topleft"></th>
                <td id="tbl-border-top">&nbsp;</td>
                <th class="topright"></th>
                <th rowspan="3" class="sized"><img src="<?php echo base_url(); ?>images/shared/side_shadowright.jpg" width="20" height="300" alt="" /></th>
            </tr>
            <tr>
                <td id="tbl-border-left"></td>
                <td>
                    <!--  start content-table-inner -->
                    <div id="content-table-inner">

                        <table border="0" width="100%" cellpadding="0" cellspacing="0">
                            <tr valign="top">
                                <td>



                                    <?php if (isset($sys_msg) && $sys_msg == "updated") { ?>

                                        <!--  start message-blue -->
                                        <div id="message-blue">
                                            <table border="0" width="100%" cellpadding="0" cellspacing="0">
                                                <tr>
                                                    <td class="blue-left">Service content updated successfully.</td>
                                                    <td class="blue-right"><a class="close-blue"><img src="<?php echo base_url(); ?>images/table/icon_close_blue.gif"   alt="" /></a></td>
                                                </tr>
                                            </table>
                                        </div>
                                        <!--  end message-blue -->

                                    <?php } ?>

                                    <!--  start step-holder -->
                                    <div id="step-holder">
                                        <div class="step-no">1</div>
                                        <div class="step-light-left"><a href="<?php echo base_url(); ?>services/view/1/<?php echo $service->Service_ID; ?>" >Event Details</a></div>
                                        <div class="step-light-right">&nbsp;</div>
                                        <div class="step-no-off">2</div>
                                        <div class="step-dark-left">Side Content</div>
                                        <div class="step-dark-round">&nbsp;</div>
                                        <div class="clear"></div>
                                    </div>
                                    <!--  end step-holder -->

                                    <!-- start id-form -->
                                    <form action="<?php echo base_url(); ?>sidecontent/add" class="validateform" method="post">

                                        <?php /*  Configure for redirection */ ?>
                                        <input type="hidden" name="redirect" value="services/view/2/<?php echo $service->Service_ID; ?>" />
                                        <input type="hidden" name="content_type" value="service"/>
                                        <input type="hidden" name="content_id" value="<?php echo $service->Service_ID; ?>"/>

                                        <table border="0" cellpadding="0" cellspacing="0"  id="id-form">
                                            <tr>
                                                <th valign="top"><span class="mandate">*</span>Title:</th>
                                                <td><input type="text" name="title" id="title" class="inp-form required" value="<?php echo $service->title; ?>"/></td>
                                                <td>
                                                    <label class="error" for="title">
                                                        <div class="error-left"></div>
                                                        <div class="error-inner">This field is required.</div>	
                                                    </label>
                                                </td>
                                            </tr>

                                            <tr>
                                                <td colspan="3" ><div class="form_divider"></div></td><!--------------------------------------------------------------------->
                                            </tr>

                                            <tr>
                                                <td colspan="3" ><h3 class="summay_header">Add Side Content</h3></td><!--------------------------------------------------------------------->
                                            </tr>

                                            <tr>
                                                <th valign="top"><span class="mandate">*</span> Title:</th>
                                                <td style="width:600px;">
                                                    <input type="text" name="side_title" id="side_title" class="inp-form required"  value=""/>
                                                </td>
                                                <td>
                                                    <label class="error" for="side_title">
                                                        <div class="error-left"></div>
                                                        <div class="error-inner">This field is required.</div>	
                                                    </label>
                                                </td>
                                            </tr>

                                            <tr>
                                                <th valign="top"><span class="mandate">*</span> Block Type:</th>
                                                <td>
                                                    <div class="select_holder">		
                                                        <select  class="styledselect_form_1 required" id="block_type_0" name="block_type_0" onchange="javascript:loadblock_option('0');">
                                                            <option value="">-- Select Block Type --</option>
                                                            <option value="staticblock">Static Block</option>
                                                            <option value="bannerblock">Banner Block</option>
                                                        </select>
                                                    </div>
                                                </td>
                                                <td>
                                                    <label class="error" for="block_type_0">
                                                        <div class="error-left"></div>
                                                        <div class="error-inner">This field is required.</div>	
                                                    </label>
                                                </td>
                                            </tr>

                                            <tr>
                                                <th valign="top"><span class="mandate">*</span> Block Title:</th>
                                                <td>
                                                    <div class="select_holder">		
                                                        <select  class="styledselect_form_1 required" id="block_id_0" name="block_id_0">
                                                            <option value="">Select Block Content</option>
                                                        </select>
                                                    </div>
                                                </td>
                                                <td>
                                                    <label class="error" for="block_id_0">
                                                        <div class="error-left"></div>
                                                        <div class="error-inner">This field is required.</div>	
                                                    </label>
                                                </td>
                                            </tr>
                                            <tr>
                                                <th valign="top"><span class="mandate">*</span> Sequence:</th>
                                                <td style="width:600px;">
                                                    <input type="text" name="side_sequence" id="side_sequence" class="inp-form"  value=""/>
                                                </td>
                                                <td>&nbsp;

                                                </td>
                                            </tr>
                                            <tr>
                                                <td colspan="3">&nbsp;</td>
                                            </tr>
                                            <tr>
                                                <th>&nbsp;</th>
                                                <td valign="top">
                                                    <input type="submit" value="" class="form-submit" />
                                                    <input type="reset" value="" class="form-reset"  />
                                                </td>
                                                <td></td>
                                            </tr>
                                            <tr>
                                                <td colspan="3" ><div class="form_divider"></div></td><!--------------------------------------------------------------------->
                                            </tr>
                                        </table>
                                    </form>
                                    <!-- end id-form  -->

                                    <!-- start id-form -->
                                    <form action="<?php echo base_url(); ?>sidecontent/update" class="validateform_second" method="post">
                                        <input type="hidden" name="redirect" value="services/view/2/<?php echo $service->Service_ID; ?>" />
                                        <input type="hidden" name="content_type" value="service"/>
                                        <input type="hidden" name="content_id" value="<?php echo $service->Service_ID; ?>"/>

                                        <table border="0" cellpadding="0" cellspacing="0"  id="id-form">
                                            <tr>
                                                <td colspan="3" ><h3 class="summay_header">Current Side Content</h3></td><!--------------------------------------------------------------------->
                                            </tr>

                                        </table>

                                        <?php
                                        $cnt = 1;

                                        if ($sidecontent->num_rows() > 0) {

                                            foreach ($sidecontent->result() as $sideitem) {
                                                ?>

                                                <!-----------------Start Side Content Item------------------->    
                                                <table border="0" cellpadding="0" cellspacing="0"  id="id-form" class="side_content_item">
                                                    <tr>
                                                        <td colspan="3" >&nbsp;</td><!--------------------------------------------------------------------->
                                                    </tr>
                                                    <tr>
                                                        <th valign="top"><span class="mandate">*</span> Title:</th>
                                                        <td style="width:600px;">
                                                            <input type="text" name="side_title_<?php echo $cnt; ?>" id="side_title_<?php echo $cnt; ?>" class="inp-form required"  value="<?php echo $sideitem->title; ?>"/>
                                                        </td>
                                                        <td>
                                                            <a class="icon-2 info-tooltip remove-sidecontent-btn" href="<?php echo base_url(); ?>sidecontent/remove/<?php echo $sideitem->idsidecontent; ?>" title="Delete"></a>  
                                                        </td>
                                                    </tr>

                                                    <tr>
                                                        <th valign="top"><span class="mandate">*</span> Block Type:</th>
                                                        <td>
                                                            <div class="select_holder">		
                                                                <select  class="styledselect_form_1 required" id="block_type_<?php echo $cnt; ?>" name="block_type_<?php echo $cnt; ?>" onchange="javascript:loadblock_option('<?php echo $cnt; ?>');">
                                                                    <option value="">-- Select Block Type --</option>
                                                                    <option value="staticblock"  <?php
                                        if ($sideitem->block_type == "staticblock") {
                                            echo "selected='selected'";
                                        }
                                        ?>>Static Block</option>
                                                                    <option value="bannerblock"  <?php
                                        if ($sideitem->block_type == "bannerblock") {
                                            echo "selected='selected'";
                                        }
                                        ?>>Banner Block</option>
                                                                </select>
                                                            </div>
                                                        </td>
                                                        <td>

                                                        </td>
                                                    </tr>

                                                    <tr>
                                                        <th valign="top"><span class="mandate">*</span> Block Title:</th>
                                                        <td>

                                                            <div class="select_holder">		
                                                                <select  class="styledselect_form_1 required" id="block_id_<?php echo $cnt; ?>" name="block_id_<?php echo $cnt; ?>">

                                                                    <?php
                                                                    if ($sideitem->block_type == "bannerblock") {
                                                                        $query = $this->bannermodel->listbanners(0);

                                                                        if ($query->num_rows() > 0) {
                                                                            foreach ($query->result() as $bannergoup) {

                                                                                $selected = "";

                                                                                if ($bannergoup->idbannergroup == $sideitem->block_id) {
                                                                                    $selected = "selected='selected'";
                                                                                }

                                                                                echo '<option value="' . $bannergoup->idbannergroup . '"' . $selected . '>' . $bannergoup->title . '</option>';
                                                                            } //end for
                                                                        } else {

                                                                            echo '<option value="">-- No Block Available --</option>';
                                                                        } // endif
                                                                    } else {
                                                                        $query = $this->staticblockmodel->liststaticblock(0);

                                                                        if ($query->num_rows() > 0) {
                                                                            foreach ($query->result() as $staticblock) {

                                                                                $selected = "";

                                                                                if ($staticblock->idstaticblock == $sideitem->block_id) {
                                                                                    $selected = "selected='selected'";
                                                                                }

                                                                                echo '<option value="' . $staticblock->idstaticblock . '"' . $selected . '>' . $staticblock->title . '</option>';
                                                                            } //end for
                                                                        } else {

                                                                            echo '<option value="">-- No Block Available --</option>';
                                                                        } // endif
                                                                    }//end if side item
                                                                    ?>

                                                                </select>
                                                            </div>
                                                        </td>
                                                        <td>

                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <th valign="top">Sequence:</th>
                                                        <td style="width:600px;">
                                                            <input type="text" name="side_sequence_<?php echo $cnt; ?>" id="side_sequence_<?php echo $cnt; ?>" class="styledtext"  value="<?php echo $sideitem->sequence; ?>"/>
                                                        </td>
                                                        <td>&nbsp;

                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td colspan="3">&nbsp;</td>
                                                    </tr>

                                                </table>
                                                <!-----------------End of Content Item------------------->    

                                                <input type="hidden" name="total_side_cnt" value="<?php echo $cnt; ?>" />
                                                <input type="hidden" name="idsidecontent_<?php echo $cnt; ?>" value="<?php echo $sideitem->idsidecontent; ?>" />

        <?php $cnt++;
    } //end for loop  
    ?>


                                            <table class="side_content_button_table">
                                                <tr>
                                                    <td colspan="3">&nbsp;</td>
                                                </tr>
                                                <tr>
                                                    <th style="width:130px;">&nbsp;</th>
                                                    <td valign="top">
                                                        <input type="submit" value="" class="form-submit" />
                                                        <input type="reset" value="" class="form-reset"  />
                                                    </td>
                                                    <td></td>
                                                </tr>
                                                <tr>
                                                    <td colspan="3" ><div class="form_divider"></div></td><!--------------------------------------------------------------------->
                                                </tr>
                                            </table>


                                        <?php } else { ?>

                                            <strong>No side content has been set. Global Side Block will be displayed instead</strong>


    <?php
} //end if 
?>


                                    </form> 
                                    <!-- end id-form  -->
                                    <form id="delete_sidecontent_hook" method="post">
                                        <input type="hidden" name="redirect" value="services/view/2/<?php echo $service->Service_ID; ?>" />
                                    </form>

                                </td>
                                <td>

<?php $this->load->view('related_activity'); ?>

                                </td>
                            </tr>
                            <tr>
                                <td><img src="<?php echo base_url(); ?>images/shared/blank.gif" width="695" height="1" alt="blank" /></td>
                                <td></td>
                            </tr>
                        </table>

                        <div class="clear"></div>


                    </div>
                    <!--  end content-table-inner  -->
                </td>
                <td id="tbl-border-right"></td>
            </tr>
            <tr>
                <th class="sized bottomleft"></th>
                <td id="tbl-border-bottom">&nbsp;</td>
                <th class="sized bottomright"></th>
            </tr>
        </table>

        <div class="clear">&nbsp;</div>

    </div>
    <!--  end content -->
    <div class="clear">&nbsp;</div>
</div>
<!--  end content-outer -->

<div class="clear">&nbsp;</div>

<?php
$this->load->view('footer')?>